import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns


class Mlt_demo:
    def __init__(self):
        plt.rcParams['font.sans-serif'] = ['Heiti TC']  # 用来正常显示中文标签
        plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号
        path = '/files/38.xlsx'
        self.df = pd.read_excel(path)
        print(self.df['Test Count'].dtype)
        # self.df['Test Count'] = pd.to_numeric(self.df['Test Count'], errors='coerce')
        # self.df.dropna(subset=['Test Count'], inplace=True)
        # self.df['Test Count'] = self.df['Test Count'].str.replace(',', '').astype(int)
        print(self.df['Test Count'].dtype)
        print(self.df['Test Count'])

    def first_plot(self):
        # sns.relplot(data=self.df, x='Station Name', y='Test Count', hue='Station Name',
        #             style='Station Name', sizes=(12, 200))
        # sns.stripplot(data=self.df, x='Station Name', y='Test Count', hue='Station ID',
        #               color=None, size=4, linewidth=1, dodge=True, marker='v' ,jitter=False)
        sns.catplot(data=self.df, x='Station Name', y='Test Count', hue='Station ID',
                      color=None, size=4, linewidth=1, dodge=True, kind='swarm')
        sns.boxenplot(data=self.df, x='Station Name', y='Test Count',color='white')
        sns.violinplot(data=self.df, x='Station Name', y='Test Count',
                       inner=None, color="1")

        plt.show(block=True)
        plt.pause(3)

        plt.close('all')


    def box(self):
        pass


ME = Mlt_demo()
ME.first_plot()
